Next | Prev | Up | Top | Contents | Index

Preliminary Considerations

The best way to develop a multiprocessor driver is to follow these steps:

  1. Implement and test a single-threaded version of the driver.

  2. Make the driver MP-safe with the use of the spinlock and semaphore calls described in this chapter.

  3. Test and debug this version of the driver. It must still work perfectly when forced onto processor 0.

  4. Add D_MP to the drvdevflag, recompile the driver, and rebuild the kernel with lboot.

    This builds a kernel that no longer forces the upper-half routines onto processor 0; they are allowed to run on the current CPU instead.

  5. Run the device driver routines on an arbitrary processor to test and fix any bugs that have been exposed.
Unfortunately, making a device driver MP-safe is not a mechanized procedure, but one that requires a good understanding of the driver and its data structures. When a driver is flagged as semaphored, the driver writer must modify the code to prepare for two new scenarios:



Next | Prev | Up | Top | Contents | Index